/**
*      author: Y_Yao
*      created: 2024-11-30 15:27:46
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 20 + 7;
int a[N],b[N],dp[3000];
int s1,s2,s3,s4;
int sum;

void solve()
{
    for(int i = 1;i <= 4;i++)
    {
        cin >> a[i];
    }

    int ans = 0;
    for(int i = 1;i <= 4;i++)
    {
        sum = 0;
        for(int j = 1;j <= a[i];j++)
        {
            cin >> b[j];
            sum += b[j];
        }

        for(int j = 1;j <= a[i];j++)
        {
            for(int k = sum / 2;k >= b[j];k--)
            {
                dp[k] = max(dp[k],dp[k - b[j]] + b[j]);
            }
        }

        ans += sum - dp[sum/2];
        for(int j = 1;j <= sum / 2;j++)
        {
            dp[j] = 0;
        }
    }

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}



